from elasticsearch import Elasticsearch

ES = [
    'https://search-bytepower-es-s5isroifywz3uyv3u7l75sagfe.cn-northwest-1.es.amazonaws.com.cn'
]
es = Elasticsearch(
    ES,
    # 启动前嗅探es集群服务器
    sniff_on_start=True,
    # es集群服务器结点连接异常时是否刷新es节点信息
    sniff_on_connection_fail=True,
    # 每60秒刷新节点信息
    sniffer_timeout=60
                   )
query = {
  'query': {
    'bool': {
      'must': [
        {'match': {'_all': 'python web'}}
      ],
      'filter': [
        {'term': {'status': 2}}
      ]
    }
  }
}
ret = es.search(index='articles', doc_type='article', body=query)

# print(es.info())
print(ret)